//
//  FinancialContentModel.m
//  quxiangtao
//
//  Created by xbmios on 2018/9/29.
//  Copyright © 2018年 shanhaijin. All rights reserved.
//

#import "FinancialContentModel.h"

@implementation FinancialContentModel

+ (void)financialModelWithPage:(NSInteger)page andClassid:(NSString *)classID success:(HttpRequestSuccess)successBlock fail:(HttpRequestFailed)failBlock {
    
    NSString *par = [NSString stringWithFormat:@"{\"user_id\" : \"%@\", \"classid\" : \"%@\", \"page\" : \"%@\", \"number\" : \"%@\"}", [RSA encryptString:[CommonUserInfo sharedInstance].user_id publicKey:PublicKey], [RSA encryptString:classID publicKey:PublicKey], [RSA encryptString:[NSString stringWithFormat:@"%ld",page] publicKey:PublicKey], [RSA encryptString:@"10" publicKey:PublicKey]];
    
    [PPNetworkHelper POST:@"user/Finance/Financelist" parameters:@{@"json" : par} success:^(id responseObject) {
        
        NSLog(@"财务记录:%@", responseObject);
        
        NSArray *arr = responseObject[@"data"];
        NSMutableDictionary *d = [NSMutableDictionary dictionaryWithDictionary:responseObject];
        
        if (arr.count > 0) {
            
            NSArray *modelArr = [FinancialContentModel mj_objectArrayWithKeyValuesArray:arr];
            
            [d removeObjectForKey:@"data"];
            [d setObject:modelArr forKey:@"data"];
        
        }
        
        if (successBlock) {
            
            successBlock(d);
        }
        
    } failure:^(NSError *error) {
        
        if (failBlock) {
            
            failBlock(error);
            
        }
        
    }];
    
}

@end
